<?php declare(strict_types=1);
/**
 * @author      xianganyall <xianganyall@gmail.com>
 * @copyright   2023-2025 owner
 **/

namespace Srv\Scripts\Cronds;

use Srv\Libs\Boot;
use Srv\Libs\Storage\DataMysql;
set_time_limit(0);

require_once dirname(__DIR__, 2).'/Libs/Boot.php';
Boot::runConf('');

// 请求记录清除-每30分钟执行
$saveMaxNum     = 100000;
$DbAuto         = DataMysql::tag('auto', 'DB_SCRIPT');
$rrId           = $DbAuto->getDataInt('SELECT rr_id FROM '.$DbAuto->getTableNameAll('adm_request_record').' ORDER BY rr_id DESC LIMIT '.$saveMaxNum.', 1', 'rr_id');
if($rrId > 0) $DbAuto->query('DELETE FROM '.$DbAuto->getTableNameAll('adm_request_record').' WHERE rr_id<'.$rrId);